﻿using System;
using Character;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using Utility;

// Token: 0x020002C2 RID: 706
public class SelectScene : Scene
{
	// Token: 0x0600121B RID: 4635 RVA: 0x00076CAC File Offset: 0x00074EAC
	private void Awake()
	{
	}

	// Token: 0x0600121C RID: 4636 RVA: 0x00076CB0 File Offset: 0x00074EB0
	private void Start()
	{
		base.InScene(false);
		this.expressionMgr.Load(this.eyeList_F, this.mouthList_F, this.eyeList_M, this.mouthList_M, this.selectExpressionList);
		GlobalData.isMemory = false;
		for (int i = 0; i < GlobalData.PlayData.personality.Length; i++)
		{
			Personality personality = GlobalData.PlayData.personality[i];
			if (personality.state == Personality.STATE.FIRST)
			{
				personality.state = Personality.STATE.RESIST;
			}
			if (personality.state >= Personality.STATE.FLIP_FLOP)
			{
				personality.state = Personality.STATE.FLOP;
			}
		}
		if (GlobalData.PlayData.lastSelectMale > MALE_ID.KOUICHI)
		{
			GlobalData.PlayData.lastSelectMale = MALE_ID.HERO;
		}
		if (GlobalData.PlayData.lastSelectVisitor == VISITOR.KOUICHI)
		{
			GlobalData.PlayData.lastSelectVisitor = VISITOR.NONE;
		}
		if (GlobalData.PlayData.Progress <= GamePlayData.PROGRESS.CLEAR_MAIN && GlobalData.PlayData.lastSelectVisitor > VISITOR.YUKIKO)
		{
			GlobalData.PlayData.lastSelectVisitor = VISITOR.NONE;
		}
		this.buttonMemory.gameObject.SetActive(GlobalData.PlayData.Progress >= GamePlayData.PROGRESS.CLEAR_MAIN);
		foreach (GameObject gameObject in this._memoryModeBlank)
		{
			gameObject.SetActive(GlobalData.PlayData.Progress < GamePlayData.PROGRESS.ALL_FREE);
		}
		foreach (GameObject gameObject2 in this._marikoMemoryButtons)
		{
			gameObject2.SetActive(GlobalData.PlayData.Progress > GamePlayData.PROGRESS.END_MARIKO);
		}
		this._startAddADVButton.gameObject.SetActive(GlobalData.PlayData.Progress == GamePlayData.PROGRESS.CLEAR_MAIN);
		if (this._startAddADVButton.gameObject.activeSelf)
		{
			this._startAddADVButton.onClick.AddListener(delegate()
			{
				SystemSE.Play(SystemSE.SE.YES);
				base.GC.ChangeScene("ADVScene", "adv/adv_10_00,ADV_Script_10_00", 1f);
			});
		}
		this.config = UnityEngine.Object.Instantiate<Config>(this.configOriginal);
		this.config.gameObject.SetActive(false);
		this.save_load = UnityEngine.Object.Instantiate<SaveLoadMode>(this.save_loadOriginal);
		this.save_load.gameObject.SetActive(false);
		base.GC.audioCtrl.BGM_LoadAndPlay(this.bgm, false, true);
		this.pauseMenue = UnityEngine.Object.Instantiate<PauseMenue>(this.pauseMenueOriginal);
		this.pauseMenue.Setup(true, true, new Action(this.Button_Config), new Action(this.Button_Exit), null);
		ScreenFade.StartFade(ScreenFade.TYPE.IN, base.GC.FadeColor, base.GC.FadeTime, 0f, null, true);
		this.UISetup();
		this.charaPos_MainFemale = Transform_Utility.FindTransform(this.charaPosRoot, "MainFemale");
		this.charaPos_MainMale = Transform_Utility.FindTransform(this.charaPosRoot, "MainMale");
		this.charaPos_Visitor = Transform_Utility.FindTransform(this.charaPosRoot, "Visitor");
		this.charaPos_SubFemale = Transform_Utility.FindTransform(this.charaPosRoot, "SubFemale");
		this.charaPos_SubMale = Transform_Utility.FindTransform(this.charaPosRoot, "SubMale");
		this.male = this.CreateMale((int)GlobalData.PlayData.lastSelectMale, this.charaPos_MainMale);
		this.female = this.CreateFemale((int)GlobalData.PlayData.lastSelectFemale, this.charaPos_MainFemale);
		this.visitor = this.CreateFemale((int)GlobalData.PlayData.lastSelectVisitor, this.charaPos_Visitor);
		for (int l = 0; l < this.visitorToggles.Length; l++)
		{
			this.visitorToggles[l].Interactable = (l != (int)GlobalData.PlayData.lastSelectFemale);
		}
		for (int m = 0; m < this.femaleToggles.Length; m++)
		{
			this.femaleToggles[m].Interactable = (m != (int)GlobalData.PlayData.lastSelectVisitor);
		}
		this.prevMapNo = GlobalData.PlayData.lastSelectMap;
		this.sceneInHeroine = GlobalData.PlayData.lastSelectFemale;
		this.LoadMap();
		this.CharaPos();
		this.LightPos();
		this.ResetCamera();
		this.UpdateState();
		if (this.sceneInMsg == "MemoryEnd")
		{
			this.memoryRoot.gameObject.SetActive(true);
		}
	}

	// Token: 0x0600121D RID: 4637 RVA: 0x000770E8 File Offset: 0x000752E8
	private void Update()
	{
		bool flag = !this.config.isActiveAndEnabled && !this.save_load.isActiveAndEnabled;
		this.uiCanvas.enabled = (flag && !base.GC.IsHideUI);
		this.pauseMenue.EnableConfig = flag;
		this.UpdateInput();
	}

	// Token: 0x0600121E RID: 4638 RVA: 0x0007714C File Offset: 0x0007534C
	public override void OutScene(string next)
	{
		base.OutScene(next);
	}

	// Token: 0x0600121F RID: 4639 RVA: 0x00077158 File Offset: 0x00075358
	private void UpdateInput()
	{
		if (EventSystem.current != null && EventSystem.current.currentSelectedGameObject != null)
		{
			return;
		}
		if (Input.GetKeyDown(KeyCode.R))
		{
			this.CameraPos();
		}
	}

	// Token: 0x06001220 RID: 4640 RVA: 0x00077194 File Offset: 0x00075394
	private Female CreateFemale(int no, Transform parent)
	{
		CustomParameter heroineCustomParam = GlobalData.PlayData.GetHeroineCustomParam((HEROINE)no);
		if (heroineCustomParam == null)
		{
			return null;
		}
		Female female = ResourceUtility.CreateInstance<Female>("FemaleBody");
		female.SetHeroineID((HEROINE)no);
		female.Load(heroineCustomParam, true);
		female.Apply();
		switch (no)
		{
		case 0:
		case 1:
		case 2:
			this.LoadAnimation(female, "pose", "AC_Edit_F");
			break;
		case 3:
			this.LoadAnimation(female, "pose_05", "AC_Edit_F_01");
			break;
		}
		Resources.UnloadUnusedAssets();
		female.ShowMosaic(false);
		IllusionCamera illusionCamera = UnityEngine.Object.FindObjectOfType<IllusionCamera>();
		female.ChangeEyeLook(LookAtRotator.TYPE.TARGET, illusionCamera.transform, false);
		if (parent != null)
		{
			female.transform.SetParent(parent, false);
		}
		return female;
	}

	// Token: 0x06001221 RID: 4641 RVA: 0x0007725C File Offset: 0x0007545C
	private Male CreateMale(int no, Transform parent)
	{
		CustomParameter maleCustomParam = GlobalData.PlayData.GetMaleCustomParam((MALE_ID)no);
		if (maleCustomParam == null)
		{
			return null;
		}
		Male male = ResourceUtility.CreateInstance<Male>("MaleBody");
		male.MaleID = (MALE_ID)no;
		male.Load(maleCustomParam, true);
		male.Apply();
		this.LoadAnimation(male, "AC_Edit_M");
		if (no == 1)
		{
			male.body.Anime.Play("tachi_pose_01");
			this.ChangeExpression(male);
		}
		else
		{
			male.body.Anime.Play("tachi_pose_02");
			this.ChangeExpression(male);
		}
		Resources.UnloadUnusedAssets();
		male.ChangeMaleShow(MALE_SHOW.CLOTHING);
		male.SetShowTinWithWear(false);
		IllusionCamera illusionCamera = UnityEngine.Object.FindObjectOfType<IllusionCamera>();
		male.ChangeEyeLook(LookAtRotator.TYPE.TARGET, illusionCamera.transform, false);
		if (parent != null)
		{
			male.transform.SetParent(parent, false);
		}
		return male;
	}

	// Token: 0x06001222 RID: 4642 RVA: 0x00077334 File Offset: 0x00075534
	private void LoadAnimation(Human human, string asset)
	{
		AssetBundleController assetBundleController = new AssetBundleController();
		assetBundleController.OpenFromFile(GlobalData.assetBundlePath, "pose");
		human.body.Anime.runtimeAnimatorController = assetBundleController.LoadAsset<RuntimeAnimatorController>(asset);
		assetBundleController.Close(false);
	}

	// Token: 0x06001223 RID: 4643 RVA: 0x00077378 File Offset: 0x00075578
	private void LoadAnimation(Human human, string assetBundle, string asset)
	{
		AssetBundleController assetBundleController = new AssetBundleController();
		assetBundleController.OpenFromFile(GlobalData.assetBundlePath, assetBundle);
		human.body.Anime.runtimeAnimatorController = assetBundleController.LoadAsset<RuntimeAnimatorController>(asset);
		assetBundleController.Close(false);
	}

	// Token: 0x06001224 RID: 4644 RVA: 0x000773B8 File Offset: 0x000755B8
	private void ChangeExpression(Human human)
	{
		this.expressionMgr.Change(human);
	}

	// Token: 0x06001225 RID: 4645 RVA: 0x000773C8 File Offset: 0x000755C8
	private void UISetup()
	{
		bool active = GlobalData.PlayData.Progress >= GamePlayData.PROGRESS.CLEAR_MAIN;
		GameObject gameObject = this.mains[0];
		for (MALE_ID male_ID = MALE_ID.HERO; male_ID <= MALE_ID.KOUICHI; male_ID++)
		{
			string title = Male.MaleName(male_ID);
			this.CreateToggleButton(title, gameObject.transform);
		}
		RadioButtonGroup radioButtonGroup = this.SetupRadioButtonGroup(gameObject, false);
		this.maleToggles = radioButtonGroup.ToggleButtons;
		radioButtonGroup.Value = (int)GlobalData.PlayData.lastSelectMale;
		radioButtonGroup.action.AddListener(new UnityAction<int>(this.ChangeMale));
		HEROINE lastSelectFemale = GlobalData.PlayData.lastSelectFemale;
		if (lastSelectFemale != HEROINE.MARIKO)
		{
			this.maleToggleButton.gameObject.SetActive(active);
		}
		else
		{
			bool active2 = GlobalData.PlayData.Progress == GamePlayData.PROGRESS.ALL_FREE;
			this.maleToggleButton.gameObject.SetActive(active2);
		}
		GameObject gameObject2 = this.mains[1];
		HEROINE heroine = (GlobalData.PlayData.Progress > GamePlayData.PROGRESS.CLEAR_MAIN) ? HEROINE.NUM : HEROINE.MARIKO;
		for (HEROINE heroine2 = HEROINE.RITSUKO; heroine2 < heroine; heroine2++)
		{
			string title2 = Female.HeroineName(heroine2);
			this.CreateToggleButton(title2, gameObject2.transform);
		}
		RadioButtonGroup radioButtonGroup2 = this.SetupRadioButtonGroup(gameObject2, false);
		this.femaleToggles = radioButtonGroup2.ToggleButtons;
		radioButtonGroup2.Value = (int)GlobalData.PlayData.lastSelectFemale;
		radioButtonGroup2.action.AddListener(new UnityAction<int>(this.ChangeFemale));
		GameObject gameObject3 = this.mains[2];
		for (HEROINE heroine3 = HEROINE.RITSUKO; heroine3 < heroine; heroine3++)
		{
			string title3 = Female.HeroineName(heroine3);
			this.CreateToggleButton(title3, gameObject3.transform);
		}
		this.CreateToggleButton("なし", gameObject3.transform);
		RadioButtonGroup radioButtonGroup3 = this.SetupRadioButtonGroup(gameObject3, false);
		this.visitorToggles = radioButtonGroup3.ToggleButtons;
		radioButtonGroup3.Value = (int)GlobalData.PlayData.lastSelectVisitor;
		radioButtonGroup3.action.AddListener(new UnityAction<int>(this.ChangeVisitor));
		GameObject gameObject4 = this.mains[3];
		this.customButton_Female = this.CreateButton("女", gameObject4.transform);
		this.customButton_Male = this.CreateButton("男", gameObject4.transform);
		this.customButton_Visitor = this.CreateButton("参観者", gameObject4.transform);
		this.customButton_Female.onClick.AddListener(new UnityAction(this.Button_CustomFemale));
		this.customButton_Male.onClick.AddListener(new UnityAction(this.Button_CustomMale));
		this.customButton_Visitor.onClick.AddListener(new UnityAction(this.Button_CustomVisitor));
		this.ChangeCustomButtonName();
		GameObject gameObject5 = this.mains[4];
		GameObject gameObject6 = Transform_Utility.FindTransform(gameObject5.transform, "Place").gameObject;
		int mapNum = GlobalData.GetMapNum();
		for (int i = 0; i < mapNum; i++)
		{
			string mapShowName = GlobalData.GetMapShowName(i);
			this.CreateToggleButton(mapShowName, gameObject6.transform);
		}
		RadioButtonGroup radioButtonGroup4 = this.SetupRadioButtonGroup(gameObject6, false);
		radioButtonGroup4.Value = GlobalData.PlayData.lastSelectMap;
		radioButtonGroup4.action.AddListener(new UnityAction<int>(this.ChangeMap));
		GameObject gameObject7 = Transform_Utility.FindTransform(gameObject5.transform, "TimeZone").gameObject;
		this.CreateToggleButton("昼", gameObject7.transform);
		this.CreateToggleButton("夕", gameObject7.transform);
		this.CreateToggleButton("夜(点灯)", gameObject7.transform);
		this.CreateToggleButton("夜(消灯)", gameObject7.transform);
		RadioButtonGroup radioButtonGroup5 = this.SetupRadioButtonGroup(gameObject7, false);
		radioButtonGroup5.Value = GlobalData.PlayData.lastSelectTimeZone;
		radioButtonGroup5.action.AddListener(new UnityAction<int>(this.ChangeTimeZone));
		GameObject gameObject8 = this.mains[5];
		this.mainStateTrans = Transform_Utility.FindTransform(gameObject8.transform, "Main");
		this.subStateTrans = Transform_Utility.FindTransform(gameObject8.transform, "Sub");
		Transform[] array = new Transform[]
		{
			this.mainStateTrans,
			this.subStateTrans
		};
		HEROINE[] array2 = new HEROINE[]
		{
			lastSelectFemale,
			(HEROINE)(GlobalData.PlayData.lastSelectVisitor - 1)
		};
		for (int j = 0; j < array.Length; j++)
		{
			int no = j;
			this.stateSets[j].stateButton.onClick.AddListener(delegate()
			{
				this.Button_State(no);
			});
			this.stateSets[j].badgeToggle[0].onValueChanged.AddListener(delegate(bool value)
			{
				this.Toggle_Badge(no, 0, value);
			});
			this.stateSets[j].badgeToggle[1].onValueChanged.AddListener(delegate(bool value)
			{
				this.Toggle_Badge(no, 1, value);
			});
			this.stateSets[j].badgeToggle[2].onValueChanged.AddListener(delegate(bool value)
			{
				this.Toggle_Badge(no, 2, value);
			});
			this.stateSets[j].badgeToggle[3].onValueChanged.AddListener(delegate(bool value)
			{
				this.Toggle_Badge(no, 3, value);
			});
			this.stateSets[j].badgeToggle[4].onValueChanged.AddListener(delegate(bool value)
			{
				this.Toggle_Badge(no, 4, value);
			});
			this.stateSets[j].vaginaVirginToggle.ActionAddListener(delegate(bool value)
			{
				this.Togge_VaginaVergin(no, value);
			});
			this.stateSets[j].analVirginToggle.ActionAddListener(delegate(bool value)
			{
				this.Togge_AnalVergin(no, value);
			});
			HEROINE heroine4 = array2[j];
			bool interactable = (heroine4 == HEROINE.MARIKO) ? (GlobalData.PlayData.Progress == GamePlayData.PROGRESS.ALL_FREE) : (GlobalData.PlayData.Progress >= GamePlayData.PROGRESS.CLEAR_MAIN);
			this.stateSets[j].stateButton.interactable = interactable;
			this.stateSets[j].badgeToggle[0].interactable = interactable;
			this.stateSets[j].badgeToggle[1].interactable = interactable;
			this.stateSets[j].badgeToggle[2].interactable = interactable;
			this.stateSets[j].badgeToggle[3].interactable = interactable;
			this.stateSets[j].badgeToggle[4].interactable = interactable;
			this.stateSets[j].vaginaVirginToggle.Interactable = interactable;
			this.stateSets[j].analVirginToggle.Interactable = interactable;
		}
		GameObject gameObject9 = this.mains[6];
		Transform transform = Transform_Utility.FindTransform(gameObject9.transform, "Main");
		Transform transform2 = Transform_Utility.FindTransform(gameObject9.transform, "Sub");
		Transform[] array3 = new Transform[]
		{
			transform,
			transform2
		};
		for (int k = 0; k < array3.Length; k++)
		{
			this.gagName[k] = this.CreateText("名前", array3[k]);
			this.gagToggles[k, 0] = this.CreateToggleButton("なし", array3[k]);
			this.gagToggles[k, 1] = this.CreateToggleButton("ﾎﾞｰﾙｷﾞｬｸﾞ", array3[k]);
			this.gagToggles[k, 2] = this.CreateToggleButton("ｶﾞﾑﾃｰﾌﾟ", array3[k]);
			int no = k;
			this.gagRadioGroup[k] = array3[k].GetComponent<RadioButtonGroup>();
			ToggleButton[] toggleButtons = new ToggleButton[]
			{
				this.gagToggles[k, 0],
				this.gagToggles[k, 1],
				this.gagToggles[k, 2]
			};
			this.gagRadioGroup[k].SetToggleButtons(toggleButtons);
			this.gagRadioGroup[k].action.AddListener(delegate(int value)
			{
				this.OnChangeGagItem(no, value);
			});
		}
	}

	// Token: 0x06001226 RID: 4646 RVA: 0x00077BAC File Offset: 0x00075DAC
	private void ChangeCustomButtonName()
	{
		bool flag = GlobalData.PlayData.lastSelectVisitor >= VISITOR.RITSUKO && GlobalData.PlayData.lastSelectVisitor < (VISITOR)4;
		this.customButton_Female.GetComponentInChildren<Text>().text = Female.HeroineName(GlobalData.PlayData.lastSelectFemale);
		this.customButton_Male.GetComponentInChildren<Text>().text = Male.MaleName(GlobalData.PlayData.lastSelectMale);
		this.customButton_Visitor.GetComponentInChildren<Text>().text = ((!flag) ? "なし" : Female.HeroineName((HEROINE)GlobalData.PlayData.lastSelectVisitor));
		this.customButton_Visitor.gameObject.SetActive(flag);
	}

	// Token: 0x06001227 RID: 4647 RVA: 0x00077C58 File Offset: 0x00075E58
	private ToggleButton CreateToggleButton(string title, Transform parent)
	{
		ToggleButton toggleButton = UnityEngine.Object.Instantiate<ToggleButton>(this.originalToggle);
		toggleButton.SetText(title, title);
		toggleButton.transform.SetParent(parent, false);
		return toggleButton;
	}

	// Token: 0x06001228 RID: 4648 RVA: 0x00077C88 File Offset: 0x00075E88
	private RadioButtonGroup SetupRadioButtonGroup(GameObject go, bool allowOff)
	{
		RadioButtonGroup radioButtonGroup = go.GetComponent<RadioButtonGroup>();
		if (radioButtonGroup == null)
		{
			radioButtonGroup = go.AddComponent<RadioButtonGroup>();
		}
		radioButtonGroup.AllowOFF = allowOff;
		ToggleButton[] componentsInChildren = go.GetComponentsInChildren<ToggleButton>();
		radioButtonGroup.SetToggleButtons(componentsInChildren);
		return radioButtonGroup;
	}

	// Token: 0x06001229 RID: 4649 RVA: 0x00077CC8 File Offset: 0x00075EC8
	private Button CreateButton(string title, Transform parent)
	{
		Button button = UnityEngine.Object.Instantiate<Button>(this.originalButton);
		button.GetComponentInChildren<Text>().text = title;
		button.transform.SetParent(parent, false);
		return button;
	}

	// Token: 0x0600122A RID: 4650 RVA: 0x00077CFC File Offset: 0x00075EFC
	private Text CreateText(string text, Transform parent)
	{
		Text text2 = UnityEngine.Object.Instantiate<Text>(this.originalText);
		text2.GetComponentInChildren<Text>().text = text;
		text2.transform.SetParent(parent, false);
		return text2;
	}

	// Token: 0x0600122B RID: 4651 RVA: 0x00077D30 File Offset: 0x00075F30
	private GameObject CreateSpace(Transform parent)
	{
		GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.originalSpace);
		gameObject.transform.SetParent(parent, false);
		return gameObject;
	}

	// Token: 0x0600122C RID: 4652 RVA: 0x00077D58 File Offset: 0x00075F58
	private void ChangeFemale(int no)
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		GlobalData.PlayData.lastSelectFemale = (HEROINE)no;
		UnityEngine.Object.Destroy(this.female.gameObject);
		bool flag = GlobalData.PlayData.Progress != GamePlayData.PROGRESS.CLEAR_MAIN || GlobalData.PlayData.lastSelectFemale != HEROINE.MARIKO;
		if (flag)
		{
			this.female = this.CreateFemale(no, this.charaPos_MainFemale);
			this.female.Foot(this.map.data.foot);
		}
		this.ChangeCustomButtonName();
		for (int i = 0; i < this.visitorToggles.Length; i++)
		{
			this.visitorToggles[i].Interactable = (i != no);
		}
		this.UpdateState();
		if (flag)
		{
			this.Voice(this.female);
		}
	}

	// Token: 0x0600122D RID: 4653 RVA: 0x00077E2C File Offset: 0x0007602C
	private void ChangeMale(int no)
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		GlobalData.PlayData.lastSelectMale = (MALE_ID)no;
		UnityEngine.Object.Destroy(this.male.gameObject);
		this.male = this.CreateMale(no, this.charaPos_MainMale);
		this.male.Foot(this.map.data.foot);
		this.ChangeCustomButtonName();
	}

	// Token: 0x0600122E RID: 4654 RVA: 0x00077E90 File Offset: 0x00076090
	private void ChangeVisitor(int no)
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		if (GlobalData.PlayData.Progress <= GamePlayData.PROGRESS.CLEAR_MAIN && no > 2)
		{
			no = -1;
		}
		GlobalData.PlayData.lastSelectVisitor = (VISITOR)no;
		if (this.visitor != null)
		{
			UnityEngine.Object.Destroy(this.visitor.gameObject);
		}
		this.visitor = this.CreateFemale(no, this.charaPos_Visitor);
		if (this.visitor != null)
		{
			this.visitor.Foot(this.map.data.foot);
		}
		this.ChangeCustomButtonName();
		for (int i = 0; i < this.femaleToggles.Length; i++)
		{
			this.femaleToggles[i].Interactable = (i != no);
		}
		this.UpdateState();
		if (this.visitor != null)
		{
			this.Voice(this.visitor);
		}
	}

	// Token: 0x0600122F RID: 4655 RVA: 0x00077F80 File Offset: 0x00076180
	private void ChangeMap(int no)
	{
		if (GlobalData.PlayData.lastSelectMap == no)
		{
			return;
		}
		SystemSE.Play(SystemSE.SE.CHOICE);
		this.prevMapNo = GlobalData.PlayData.lastSelectMap;
		GlobalData.PlayData.lastSelectMap = no;
		this.LoadMap();
		this.CharaPos();
		this.LightPos();
		this.CameraPos();
	}

	// Token: 0x06001230 RID: 4656 RVA: 0x00077FD8 File Offset: 0x000761D8
	private void ChangeTimeZone(int no)
	{
		if (GlobalData.PlayData.lastSelectTimeZone == no)
		{
			return;
		}
		SystemSE.Play(SystemSE.SE.CHOICE);
		GlobalData.PlayData.lastSelectTimeZone = no;
		this.LoadMap();
		this.LightPos();
	}

	// Token: 0x06001231 RID: 4657 RVA: 0x00078008 File Offset: 0x00076208
	private void LoadMap()
	{
		string[] array = new string[]
		{
			"day",
			"evening",
			"night_light",
			"night_dark"
		};
		string map_path = GlobalData.GetMapAssetBundleName(GlobalData.PlayData.lastSelectMap) + "_" + array[GlobalData.PlayData.lastSelectTimeZone];
		this.LoadMap(map_path);
		this.Foot();
	}

	// Token: 0x06001232 RID: 4658 RVA: 0x00078070 File Offset: 0x00076270
	private void Foot()
	{
		this.female.Foot(this.map.data.foot);
		this.male.Foot(this.map.data.foot);
		if (this.visitor != null)
		{
			this.visitor.Foot(this.map.data.foot);
		}
	}

	// Token: 0x06001233 RID: 4659 RVA: 0x000780E0 File Offset: 0x000762E0
	private void LoadMap(string map_path)
	{
		if (this.map != null)
		{
			UnityEngine.Object.Destroy(this.map.gameObject);
			this.map = null;
		}
		AssetBundleController assetBundleController = new AssetBundleController();
		assetBundleController.OpenFromFile(GlobalData.assetBundlePath, map_path);
		string[] array = new string[]
		{
			"day",
			"evening",
			"night_light",
			"night_dark"
		};
		string assetName = GlobalData.GetMapAssetName(GlobalData.PlayData.lastSelectMap) + "_" + array[GlobalData.PlayData.lastSelectTimeZone];
		GameObject gameObject = assetBundleController.LoadAndInstantiate<GameObject>(assetName);
		this.map = gameObject.GetComponent<Map>();
		assetBundleController.Close(false);
		LightMapControl componentInChildren = this.map.GetComponentInChildren<LightMapControl>();
		componentInChildren.Apply();
		Resources.UnloadUnusedAssets();
	}

	// Token: 0x06001234 RID: 4660 RVA: 0x000781AC File Offset: 0x000763AC
	private void CharaPos()
	{
		this.charaPosRoot.position = this.map.data.selectPos;
		this.charaPosRoot.rotation = Quaternion.Euler(0f, this.map.data.selectYaw, 0f);
	}

	// Token: 0x06001235 RID: 4661 RVA: 0x00078200 File Offset: 0x00076400
	private void ResetCamera()
	{
		Vector3 position = this.charaPosRoot.position;
		position.y += 1.3f;
		Vector3 zero = Vector3.zero;
		zero.y = this.map.data.selectYaw + 180f;
		float num = 25f / ConfigData.defParse;
		this.cam.Set(position, zero, 2.5f * num, ConfigData.defParse);
	}

	// Token: 0x06001236 RID: 4662 RVA: 0x00078274 File Offset: 0x00076474
	private void CameraPos()
	{
		Vector3 position = this.charaPosRoot.position;
		position.y += 1.3f;
		Vector3 zero = Vector3.zero;
		zero.y = this.map.data.selectYaw + 180f;
		float num = 25f / this.cam.FOV;
		this.cam.Set(position, zero, 2.5f * num, 0f);
	}

	// Token: 0x06001237 RID: 4663 RVA: 0x000782F0 File Offset: 0x000764F0
	private void LightPos()
	{
		float selectYaw = this.map.data.selectYaw;
		this.map.lightRoot.rotation = Quaternion.Euler(20f, selectYaw + 180f, 0f);
	}

	// Token: 0x06001238 RID: 4664 RVA: 0x00078334 File Offset: 0x00076534
	public void Button_Config()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_open);
		this.config.gameObject.SetActive(true);
	}

	// Token: 0x06001239 RID: 4665 RVA: 0x00078368 File Offset: 0x00076568
	public void Button_Exit()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_choice);
		base.GC.CreateModalYesNoUI("タイトルに戻ります。\nセーブしていない場合は\nゲームの進行状況、キャラカスタム等は失われます。\nよろしいですか？", new Action(this.ToTitle), null);
	}

	// Token: 0x0600123A RID: 4666 RVA: 0x000783A8 File Offset: 0x000765A8
	private void ExitGame()
	{
		base.GC.ChangeScene("ExitScene", string.Empty, 1f);
	}

	// Token: 0x0600123B RID: 4667 RVA: 0x000783C4 File Offset: 0x000765C4
	private void ToTitle()
	{
		base.GC.ChangeScene("TitleScene", string.Empty, 1f);
	}

	// Token: 0x0600123C RID: 4668 RVA: 0x000783E0 File Offset: 0x000765E0
	public void ChangeTab(int no)
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		for (int i = 0; i < this.mains.Length; i++)
		{
			this.mains[i].SetActive(i == no);
		}
	}

	// Token: 0x0600123D RID: 4669 RVA: 0x00078420 File Offset: 0x00076620
	public void Button_H()
	{
		SystemSE.Play(SystemSE.SE.YES);
		base.GC.ChangeScene("H", string.Empty, -1f);
	}

	// Token: 0x0600123E RID: 4670 RVA: 0x00078444 File Offset: 0x00076644
	public void UpdateState()
	{
		this.invoke = false;
		bool active = (GlobalData.PlayData.lastSelectFemale != HEROINE.MARIKO) ? (GlobalData.PlayData.Progress >= GamePlayData.PROGRESS.CLEAR_MAIN) : (GlobalData.PlayData.Progress == GamePlayData.PROGRESS.ALL_FREE);
		this.maleToggleButton.gameObject.SetActive(active);
		Female[] array = new Female[]
		{
			this.female,
			this.visitor
		};
		Transform[] array2 = new Transform[]
		{
			this.mainStateTrans,
			this.subStateTrans
		};
		string[] array3 = new string[]
		{
			"初回",
			"抵抗",
			"豹変",
			"豹変イベント",
			"姉妹最終イベント",
			"雪子最終イベント１",
			"雪子最終イベント２",
			"真理子最終イベント"
		};
		string[,] array4 = new string[4, 2];
		array4[0, 0] = "hp00_f_00_00";
		array4[0, 1] = "hp00_f_01_00";
		array4[1, 0] = "hp01_f_00_00";
		array4[1, 1] = "hp01_f_01_00";
		array4[2, 0] = "hp02_f_00_00";
		array4[2, 1] = "hp02_f_01_00";
		array4[3, 0] = "hp03_f_00_00";
		array4[3, 1] = "hp03_f_01_00";
		string[,] array5 = array4;
		for (int i = 0; i < array.Length; i++)
		{
			array2[i].gameObject.SetActive(array[i] != null);
			this.gagRadioGroup[i].gameObject.SetActive(array[i] != null);
			if (!(array[i] == null))
			{
				string text = Female.HeroineName(array[i].HeroineID);
				this.stateSets[i].stateName.text = text;
				this.stateSets[i].stateButton.GetComponentInChildren<Text>().text = array3[(int)array[i].personality.state];
				this.stateSets[i].badgeToggle[0].isOn = array[i].personality.feelVagina;
				this.stateSets[i].badgeToggle[1].isOn = array[i].personality.feelAnus;
				this.stateSets[i].badgeToggle[2].isOn = array[i].personality.indecentLanguage;
				this.stateSets[i].badgeToggle[3].isOn = array[i].personality.likeFeratio;
				this.stateSets[i].badgeToggle[4].isOn = array[i].personality.likeSperm;
				this.stateSets[i].badgeGage[0].fillAmount = array[i].personality.ExpFeelVaginaRate;
				this.stateSets[i].badgeGage[1].fillAmount = array[i].personality.ExpFeelAnusRate;
				this.stateSets[i].badgeGage[2].fillAmount = array[i].personality.ExpIndecentLanguageRate;
				this.stateSets[i].badgeGage[3].fillAmount = array[i].personality.ExpLikeFeratioRate;
				this.stateSets[i].badgeGage[4].fillAmount = array[i].personality.ExpLikeSpermRate;
				this.stateSets[i].vaginaVirginToggle.ChangeValue(array[i].personality.vaginaVirgin, false);
				this.stateSets[i].analVirginToggle.ChangeValue(array[i].personality.analVirgin, false);
				bool flag = true;
				if (array[i].HeroineID == HEROINE.YUKIKO)
				{
					flag = false;
				}
				bool flag2;
				if (array[i].HeroineID != HEROINE.MARIKO)
				{
					flag2 = (GlobalData.PlayData.Progress >= GamePlayData.PROGRESS.CLEAR_MAIN);
				}
				else
				{
					flag2 = (GlobalData.PlayData.Progress == GamePlayData.PROGRESS.ALL_FREE);
				}
				this.stateSets[i].stateButton.interactable = flag2;
				foreach (Toggle toggle in this.stateSets[i].badgeToggle)
				{
					toggle.interactable = flag2;
				}
				this.stateSets[i].vaginaVirginToggle.Interactable = (flag2 && flag);
				this.stateSets[i].analVirginToggle.Interactable = flag2;
				this.gagName[i].text = text;
				this.gagRadioGroup[i].Change((int)array[i].personality.gagItem, false);
				int heroineID = (int)array[i].HeroineID;
				int num = (!array[i].IsFloped()) ? 0 : 1;
				string stateName = array5[heroineID, num];
				array[i].body.Anime.Play(stateName, 0);
				this.ChangeExpression(array[i]);
			}
		}
		this.invoke = true;
	}

	// Token: 0x0600123F RID: 4671 RVA: 0x0007892C File Offset: 0x00076B2C
	private void Button_State(int no)
	{
		string[] array = new string[]
		{
			"初回",
			"抵抗",
			"豹変",
			"豹変イベント",
			"姉妹最終イベント",
			"雪子最終イベント１",
			"雪子最終イベント２",
			"真理子最終イベント"
		};
		Female[] array2 = new Female[]
		{
			this.female,
			this.visitor
		};
		Female female = array2[no];
		if (female.personality.state == Personality.STATE.RESIST)
		{
			female.personality.state = Personality.STATE.FLOP;
		}
		else
		{
			female.personality.state = Personality.STATE.RESIST;
		}
		this.stateSets[no].stateButton.GetComponentInChildren<Text>().text = array[(int)female.personality.state];
		SystemSE.Play(SystemSE.SE.CHOICE);
		string[,] array3 = new string[4, 2];
		array3[0, 0] = "hp00_f_00_00";
		array3[0, 1] = "hp00_f_01_00";
		array3[1, 0] = "hp01_f_00_00";
		array3[1, 1] = "hp01_f_01_00";
		array3[2, 0] = "hp02_f_00_00";
		array3[2, 1] = "hp02_f_01_00";
		array3[3, 0] = "hp03_f_00_00";
		array3[3, 1] = "hp03_f_01_00";
		string[,] array4 = array3;
		int heroineID = (int)female.HeroineID;
		int num = (!female.IsFloped()) ? 0 : 1;
		string stateName = array4[heroineID, num];
		female.body.Anime.CrossFadeInFixedTime(stateName, 0.3f, 0);
		this.ChangeExpression(female);
	}

	// Token: 0x06001240 RID: 4672 RVA: 0x00078AAC File Offset: 0x00076CAC
	private void Toggle_Badge(int no, int badge, bool value)
	{
		if (!this.invoke)
		{
			return;
		}
		Female[] array = new Female[]
		{
			this.female,
			this.visitor
		};
		Female female = array[no];
		if (badge == 0)
		{
			female.personality.feelVagina = value;
		}
		if (badge == 1)
		{
			female.personality.feelAnus = value;
		}
		if (badge == 2)
		{
			female.personality.indecentLanguage = value;
		}
		if (badge == 3)
		{
			female.personality.likeFeratio = value;
		}
		if (badge == 4)
		{
			female.personality.likeSperm = value;
		}
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06001241 RID: 4673 RVA: 0x00078B48 File Offset: 0x00076D48
	private void Togge_VaginaVergin(int no, bool value)
	{
		if (!this.invoke)
		{
			return;
		}
		Female[] array = new Female[]
		{
			this.female,
			this.visitor
		};
		Female female = array[no];
		female.personality.vaginaVirgin = value;
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06001242 RID: 4674 RVA: 0x00078B90 File Offset: 0x00076D90
	private void Togge_AnalVergin(int no, bool value)
	{
		if (!this.invoke)
		{
			return;
		}
		Female[] array = new Female[]
		{
			this.female,
			this.visitor
		};
		Female female = array[no];
		female.personality.analVirgin = value;
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x06001243 RID: 4675 RVA: 0x00078BD8 File Offset: 0x00076DD8
	private void Button_CustomFemale()
	{
		SystemSE.Play(SystemSE.SE.YES);
		string charaName = Female.HeroineName(GlobalData.PlayData.lastSelectFemale);
		string msg = EditScene.CreateMessage(charaName, "SelectScene");
		this.gameCtrl.ChangeScene("EditScene", msg, -1f);
	}

	// Token: 0x06001244 RID: 4676 RVA: 0x00078C20 File Offset: 0x00076E20
	private void Button_CustomMale()
	{
		SystemSE.Play(SystemSE.SE.YES);
		string charaName = Male.MaleName(GlobalData.PlayData.lastSelectMale);
		string msg = EditScene.CreateMessage(charaName, "SelectScene");
		this.gameCtrl.ChangeScene("EditScene", msg, -1f);
	}

	// Token: 0x06001245 RID: 4677 RVA: 0x00078C68 File Offset: 0x00076E68
	private void Button_CustomVisitor()
	{
		SystemSE.Play(SystemSE.SE.YES);
		string charaName = Female.HeroineName((HEROINE)GlobalData.PlayData.lastSelectVisitor);
		string msg = EditScene.CreateMessage(charaName, "SelectScene");
		this.gameCtrl.ChangeScene("EditScene", msg, -1f);
	}

	// Token: 0x06001246 RID: 4678 RVA: 0x00078CB0 File Offset: 0x00076EB0
	public void Button_Save()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_open);
		this.save_load.Setup(SaveLoadMode.MODE.SAVE);
		this.save_load.gameObject.SetActive(true);
	}

	// Token: 0x06001247 RID: 4679 RVA: 0x00078CF0 File Offset: 0x00076EF0
	public void Button_Load()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_open);
		this.save_load.Setup(SaveLoadMode.MODE.LOAD);
		this.save_load.gameObject.SetActive(true);
	}

	// Token: 0x06001248 RID: 4680 RVA: 0x00078D30 File Offset: 0x00076F30
	public void Button_Memory()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_open);
		this.memoryRoot.gameObject.SetActive(true);
	}

	// Token: 0x06001249 RID: 4681 RVA: 0x00078D64 File Offset: 0x00076F64
	public void Button_MemoryClose()
	{
		base.GC.audioCtrl.Play2DSE(base.GC.audioCtrl.systemSE_close);
		this.memoryRoot.gameObject.SetActive(false);
	}

	// Token: 0x0600124A RID: 4682 RVA: 0x00078D98 File Offset: 0x00076F98
	public void OnChangeGagItem(int main_sub, int value)
	{
		Female[] array = new Female[]
		{
			this.female,
			this.visitor
		};
		Female female = array[main_sub];
		female.personality.gagItem = (GAG_ITEM)value;
		female.ChangeGagItem();
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x0600124B RID: 4683 RVA: 0x00078DDC File Offset: 0x00076FDC
	public void LoadMemory(int no)
	{
		SystemSE.Play(SystemSE.SE.YES);
		string[] array = new string[]
		{
			"00_00",
			"00_01",
			"00_03",
			"00_04",
			"01_00",
			"01_01",
			"01_03",
			"02_00",
			"02_01",
			"02_02",
			"02_03",
			"10_00",
			"11_00",
			"12_00"
		};
		if (no < 0 || no >= array.Length)
		{
			return;
		}
		string msg = "adv/adv_" + array[no] + ",ADV_Script_" + array[no];
		GlobalData.isMemory = true;
		base.GC.ChangeScene("ADVScene", msg, 1f);
	}

	// Token: 0x0600124C RID: 4684 RVA: 0x00078EB0 File Offset: 0x000770B0
	private void Voice(Female female)
	{
		if (female == null)
		{
			return;
		}
		string text = "SystemVoice/CharaSelect/CharaSelect_";
		string[] array = new string[]
		{
			"A",
			"B"
		};
		int num = (!female.IsFloped()) ? 0 : 1;
		text = text + "F" + ((int)female.HeroineID).ToString("00") + "_";
		if (female.Gag)
		{
			text = text + "Gag" + array[num];
		}
		else if (this.sceneInHeroine == female.HeroineID)
		{
			text = text + "Continuous" + array[num];
		}
		else
		{
			int num2 = UnityEngine.Random.Range(0, 2);
			text = text + array[num] + num2.ToString("00");
		}
		AudioClip audioClip = Resources.Load<AudioClip>(text);
		if (audioClip == null)
		{
			GlobalData.Debug_LogError("没有音频剪辑");
			return;
		}
		female.PhonationVoice(audioClip, false);
	}

	// Token: 0x040013EA RID: 5098
	[SerializeField]
	private Canvas uiCanvas;

	// Token: 0x040013EB RID: 5099
	[SerializeField]
	private Config configOriginal;

	// Token: 0x040013EC RID: 5100
	private Config config;

	// Token: 0x040013ED RID: 5101
	[SerializeField]
	private SaveLoadMode save_loadOriginal;

	// Token: 0x040013EE RID: 5102
	private SaveLoadMode save_load;

	// Token: 0x040013EF RID: 5103
	[SerializeField]
	private PauseMenue pauseMenueOriginal;

	// Token: 0x040013F0 RID: 5104
	private PauseMenue pauseMenue;

	// Token: 0x040013F1 RID: 5105
	[SerializeField]
	private ToggleButton originalToggle;

	// Token: 0x040013F2 RID: 5106
	[SerializeField]
	private Button originalButton;

	// Token: 0x040013F3 RID: 5107
	[SerializeField]
	private Text originalText;

	// Token: 0x040013F4 RID: 5108
	[SerializeField]
	private GameObject originalSpace;

	// Token: 0x040013F5 RID: 5109
	[SerializeField]
	private GameObject[] mains;

	// Token: 0x040013F6 RID: 5110
	[SerializeField]
	private ToggleButton maleToggleButton;

	// Token: 0x040013F7 RID: 5111
	private Button customButton_Female;

	// Token: 0x040013F8 RID: 5112
	private Button customButton_Male;

	// Token: 0x040013F9 RID: 5113
	private Button customButton_Visitor;

	// Token: 0x040013FA RID: 5114
	private Male male;

	// Token: 0x040013FB RID: 5115
	private Female female;

	// Token: 0x040013FC RID: 5116
	private Female visitor;

	// Token: 0x040013FD RID: 5117
	private Map map;

	// Token: 0x040013FE RID: 5118
	[SerializeField]
	private Transform charaPosRoot;

	// Token: 0x040013FF RID: 5119
	private Transform charaPos_MainFemale;

	// Token: 0x04001400 RID: 5120
	private Transform charaPos_MainMale;

	// Token: 0x04001401 RID: 5121
	private Transform charaPos_Visitor;

	// Token: 0x04001402 RID: 5122
	private Transform charaPos_SubFemale;

	// Token: 0x04001403 RID: 5123
	private Transform charaPos_SubMale;

	// Token: 0x04001404 RID: 5124
	[SerializeField]
	private IllusionCamera cam;

	// Token: 0x04001405 RID: 5125
	[SerializeField]
	private Button buttonMemory;

	// Token: 0x04001406 RID: 5126
	[SerializeField]
	private Button _startAddADVButton;

	// Token: 0x04001407 RID: 5127
	[SerializeField]
	[Header("Memory")]
	private GameObject memoryRoot;

	// Token: 0x04001408 RID: 5128
	[SerializeField]
	private GameObject[] _memoryModeBlank;

	// Token: 0x04001409 RID: 5129
	[SerializeField]
	private GameObject[] _marikoMemoryButtons = new GameObject[3];

	// Token: 0x0400140A RID: 5130
	private ToggleButton[] maleToggles;

	// Token: 0x0400140B RID: 5131
	private ToggleButton[] femaleToggles;

	// Token: 0x0400140C RID: 5132
	private ToggleButton[] visitorToggles;

	// Token: 0x0400140D RID: 5133
	private Transform mainStateTrans;

	// Token: 0x0400140E RID: 5134
	private Transform subStateTrans;

	// Token: 0x0400140F RID: 5135
	[Space]
	[SerializeField]
	private SelectScene.StateSet[] stateSets = new SelectScene.StateSet[2];

	// Token: 0x04001410 RID: 5136
	private Text[] gagName = new Text[2];

	// Token: 0x04001411 RID: 5137
	private RadioButtonGroup[] gagRadioGroup = new RadioButtonGroup[2];

	// Token: 0x04001412 RID: 5138
	private ToggleButton[,] gagToggles = new ToggleButton[2, 3];

	// Token: 0x04001413 RID: 5139
	private string bgm = "Select";

	// Token: 0x04001414 RID: 5140
	private int prevMapNo = -1;

	// Token: 0x04001415 RID: 5141
	private bool invoke = true;

	// Token: 0x04001416 RID: 5142
	[SerializeField]
	private TextAsset eyeList_F;

	// Token: 0x04001417 RID: 5143
	[SerializeField]
	private TextAsset mouthList_F;

	// Token: 0x04001418 RID: 5144
	[SerializeField]
	private TextAsset eyeList_M;

	// Token: 0x04001419 RID: 5145
	[SerializeField]
	private TextAsset mouthList_M;

	// Token: 0x0400141A RID: 5146
	[SerializeField]
	private TextAsset selectExpressionList;

	// Token: 0x0400141B RID: 5147
	private SelectExpressionManager expressionMgr = new SelectExpressionManager();

	// Token: 0x0400141C RID: 5148
	private HEROINE sceneInHeroine;

	// Token: 0x020002C3 RID: 707
	[Serializable]
	public class StateSet
	{
		// Token: 0x0400141D RID: 5149
		public Text stateName;

		// Token: 0x0400141E RID: 5150
		public Button stateButton;

		// Token: 0x0400141F RID: 5151
		public Toggle[] badgeToggle = new Toggle[5];

		// Token: 0x04001420 RID: 5152
		public Image[] badgeGage = new Image[5];

		// Token: 0x04001421 RID: 5153
		public ToggleButton vaginaVirginToggle;

		// Token: 0x04001422 RID: 5154
		public ToggleButton analVirginToggle;
	}

	// Token: 0x020002C4 RID: 708
	private enum TAB
	{
		// Token: 0x04001424 RID: 5156
		MALE,
		// Token: 0x04001425 RID: 5157
		FEMALE,
		// Token: 0x04001426 RID: 5158
		VISITOR,
		// Token: 0x04001427 RID: 5159
		CUSTOM,
		// Token: 0x04001428 RID: 5160
		MAP,
		// Token: 0x04001429 RID: 5161
		STATE,
		// Token: 0x0400142A RID: 5162
		GAG
	}
}
